const path = require("path");
const webpack = require("webpack");
module.exports = {
  entry: {
    // 需要提前处理的第三方模块
    vendor: ["vue/dist/vue.esm.js", "vue-router", "axios", "loadsh"]
  },
  output: {
    path: path.join(__dirname, "../static/js"),
    filename: "[name].dll.js",
    library: "[name]_library"
  },
  plugins: [
    // 把提前打包的东西生成一个json，告诉真正打包的时候这些东西已经打过包了
    new webpack.DllPlugin({
      path: path.join(__dirname, ".", "[name]-manifest.json"),
      name: "[name]_library" // 与output的library一致
    })
  ]
};
// 优化之前，打包3.08s
// yarn dll，2.04s
// 然后打包：2.45s
